﻿@model Metro.Kashikoi.Web.ViewModels.LocationUnitModel
@{
    ViewBag.Title = "Unit";
    Layout = "~/Views/Shared/LocationLayout.cshtml";
    ViewBag.TreeId = "unit_" + Model.CurrentUnit.Id;
    ViewBag.Organization = Model.Organization;
}
<h4>
    Unit - @Model.CurrentUnit.Name</h4>
@Html.Partial("InventoryList", Model.Inventories)
@section RightBar
{
    <div>
        Organize
        <ul>
            <li><a href="#" id="rename">Rename </a></li>
            <li><a href="#" id="addStockArea">Add Stock Area </a></li>
        </ul>
    </div>
    <div>
        Authorized users
        <ul>
            <li>Mac Lee </li>
            <li>John Tian </li>
        </ul>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {

            $("#rename").click(function () {
                $("#dialog-rename").dialog("open");
            });
            $("#addStockArea").click(function () {
                $("#dialog-addStockArea").dialog("open");
            });

            $("#dialog-rename").dialog({
                autoOpen: false,
                modal: true,
                resizable: false
            });
            $("#dialog-addStockArea").dialog({
                autoOpen: false,
                modal: true,
                resizable: false
            }
            );
        }
    )
 
    </script>
    <div id="dialog-rename" title="Rename">
        <form action="/Location/RenameUnit" method="post">
        <label for="name">
            Name</label>
        <input type="text" id="unitId" name="unitId" value="@Model.CurrentUnit.Id" style="visibility:hidden"/>
        <input type="text" id="unitName" name="unitName" value="@Model.CurrentUnit.Name"/>
        <input type="submit" value="OK" />
        </form>
    </div>
    <div id="dialog-addStockArea" title="Add Stock Area">
        <form action="/Location/AddStockArea" method="post">
        <label for="name">
            Name</label>
        <input type="text" id="unitId" name="unitId" value="@Model.CurrentUnit.Id" style="visibility:hidden"/>
        <input type="text" id="stockAreaName" name="stockAreaName" value="NewStockArea1" />
        <input type="submit" value="OK" />
        </form>
    </div>
}
